﻿
(function () {
	window.isopen = false;


	// setInterval(() => {
	// 	chrome.storage.local.get('isopen', function (items) {

			window.key = true



			if (window.key) {
				console.log("成功")
				window.key = false
				if (!window.isopen) {
					
					submints()
					}

				
			}

	// 	})




	// }, 5000)
})();

function submints(){

	window.isopen = true

			
	window.settime = null
	window.index=1
		if (window.settime == null) {
			console.log("成功了")
			window.settime = setInterval(() => {
				console.log("开始投递")
				setTimeout(() => {
					document.querySelector("#wrap > div.page-job-wrapper > div.page-job-inner > div > div.job-list-wrapper > div.search-job-result > ul > li:nth-child(" + String(window.index) + ") > div.job-card-body.clearfix > a > div.job-info.clearfix > a").click()
					console.log("访问成功")

				},3000)
				setTimeout(() => {
					window.history.back()
					console.log("返回成功")
				}, 8000)
				window.index+=1
				if (window.index == 21) {
					clearInterval(settime)
					window.settime = null;
				}
			}, 15000)
			if (window.index== 21) {
				document.querySelector("#wrap > div.page-job-wrapper > div.page-job-inner > div > div.job-list-wrapper > div.search-job-result > div > div > div > a:nth-child(10)").click()
				window.index = 1;
				
				setTimeout(() => {
					submints()
					console.log("换页成功")
				}, 10000)
			}
		}
}